﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using snat.model;
using algorithms.Factories.Relabel;
using algorithms.algorithms.PageRankAlgorithm;

namespace cmd {

    internal class Program {

        /// <summary>
        /// This method should contain a script as follows:
        ///   1). Connect to a database with the SNAT schema
        ///   2). Initialize nodes in the network model
        ///   3). Register algorithms as appropriate
        ///   4). Initialize the edges and message iterator in the network model
        ///   5). Play, step or skip to the end of the tape to run the algorithm
        ///   6). Output the algorithm's results in some format
        /// </summary>
        /// <param name="args"></param>
        private static void Main(string[] args) {

            // Connect and initialise nodes
            NetworkModel.Instance.Connect("mysql5.dcs.warwick.ac.uk", 3389, "snag2", "snag_read", "JeBngXFmMQFMheBD");
           // NetworkModel.Instance.InitNodes(new RelabelFactory("../../../algorithms/Factories/Relabel/EnronFormat"));
            NetworkModel.Instance.InitNodes();

            // Register algorithms
            PageRank ranker = new PageRank();
            ranker.Register();

            // Initialise edges and play through the message
            NetworkModel.Instance.Init();
            NetworkModel.Instance.SkipAllMessages();

            // Output results
            Console.WriteLine(ranker.GetRenderableText());


            Console.WriteLine("Processing has finished. Press any key to exit");
            Console.ReadLine();
        }
    }
}